package com.weblog.user;

import com.weblog.user.utils.AccessUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import util.IdWorker;
import util.JwtUtil;
import util.MapSizeUtil;

@SpringBootApplication
@EnableEurekaClient
@EnableAspectJAutoProxy
@EnableFeignClients
@ComponentScan(basePackages = "com.weblog")
@EntityScan(basePackages = {"com.weblog.model.user"})
public class UserApplication {
    public static void main(String[] args) {
        SpringApplication.run(UserApplication.class,args);
    }

    @Bean
    public IdWorker idWorker(){
        return new IdWorker(1,1);
    }
    @Bean
    public BCryptPasswordEncoder encoder(){
        return new BCryptPasswordEncoder();
    }

    @Bean
    public JwtUtil jwtUtil(){
        return new JwtUtil();
    }

    @Bean
    public AccessUtil accessUtil(){
        return new AccessUtil();
    }

    @Bean
    public MapSizeUtil mapSizeUtil(){
        return new MapSizeUtil();
    }
}
